#!/usr/bin/Python
# -*- coding: utf-8 -*-
class UrlManager(object):
    def __init__(self,page):
        self.new_page_url = set()
        self.old_page_url = set()
        self.new_pics_url = set()
        self.old_pics_url = set()
        self.page = page
        self._structure_page()

    def get_page_urls(self):
        page_url = self.new_page_url.pop()
        self.old_page_url.add(page_url)
        return page_url

    def _structure_page(self):
        for page in range(1,int(self.page)+1):
            page_url = 'http://www.jdlingyu.moe/page/%s/' % page
            self.new_page_url.add(page_url)

    def add_pics_url(self,pics_url):
        self.new_pics_url.add(pics_url)

    def get_pics_urls(self):
        pics_urls = self.new_pics_url.pop()
        self.old_pics_url.add(pics_urls)
        return pics_urls

    def han_new_pics_url(self):
        return len(self.new_pics_url) != 0

    def has_new_page_url(self):
        return len(self.new_page_url) != 0